<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>100.0020.浏览器原理-20-async_await-03测试</title>
    <script>

      // window.onload = function(){
      //   console.log('js执行完成 , window context 退出');
      // }
    </script>
</head>
<body>
    <div>
        <div id="showRespDataId"></div>
        <hr><br><hr>
        <div id="showAllNet"></div>
    </div>
</body>
<script>
async function foo() {
    console.log('foo')
}
async function bar() {
    console.log('bar start')
    await foo()
    console.log('bar end')
}
console.log('script start')
setTimeout(function () {
    console.log('setTimeout')
}, 0)
bar();
new Promise(function (resolve) {
    console.log('promise executor')
    resolve();
}).then(function () {
    console.log('promise then')
})
console.log('script end')

/**
个人尝试：
script start
bar start
bar end
promise executor
script end
// setTimeout
foo
promise then
// setTimeout
 */

 /*
script start
 bar start
 foo
 promise executor
 script end
 bar end
 promise then
 setTimeout
 */

</script>
</html>